package com.bootdo.system.controller;

import com.bootdo.common.utils.PageUtils;
import com.bootdo.common.utils.Query;
import com.bootdo.common.utils.R;
import com.bootdo.system.domain.SysUserCache;
import com.bootdo.system.service.SysUserCacheService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @create 2021-03-02 13-53
 */
@Api(description = "后台用户提现")
@Controller
@RequestMapping("/user/cache")
public class SysUserCacheController {

    @GetMapping
    public String cacheUrl(){
        return "system/adminTxgl/txgl";
    }


    @Autowired
    private SysUserCacheService cacheService;

    @PostMapping("/add")
    public R insertCache(SysUserCache userCache){
        return cacheService.insertSysUserCache(userCache);
    }


    @PostMapping("/update")
    @ResponseBody
    public R updateCache(SysUserCache sysUserCache){
        return cacheService.updateSysUserCache(sysUserCache);
    }

    @GetMapping("/list")
    @ResponseBody
    public PageUtils selectCacheList(@RequestParam Map map){
        Query query = new Query(map);
        List list = cacheService.selectSysUserCacheList(query);
        int i = cacheService.selectUserCount(query);
        PageUtils pageUtils = new PageUtils(list, i);
        return pageUtils;
    }

}
